﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;

namespace Microhard.Core.Extensions
{
    public class ImageExtension
    {
        public byte[] WriteImageMark(System.Drawing.Image image)
        {
            using (Graphics g = Graphics.FromImage(image))
            {
                string text = "Hello World!";

                // Create font and brush.
                Font drawFont = new Font("Arial", 10);
                SolidBrush drawBrush = new SolidBrush(Color.Black);

                // Create point for upper-left corner of drawing.
                PointF stringPonit = new PointF(0, 0);

                g.DrawString(text, drawFont, drawBrush, stringPonit);
            }
            MemoryStream ms = new MemoryStream();
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            return ms.ToArray();
        }
    }
}
